/*
 * libmanyuc - Template specifications file
 * Copyright (C) 2012 - Margarita Manterola Rivero
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
 * MA 02110-1301 USA
 */

#ifndef LM4FXXX_COMMON_H
#define LM4FXXX_COMMON_H

/* Macros and declarations needed for this port */
#ifdef __cplusplus
extern "C" {
#endif

//#include "inc/lm4f120h5qr.h"
#include "rom.h"
#include "rom_map.h"
#include <stdint.h>
#include "inc/hw_memmap.h"
#include "inc/hw_types.h"
#include "inc/hw_sysctl.h"
#include "driverlib/gpio.h"
#include "driverlib/sysctl.h"

#define LM4F_GPIO_BASE 0
// Typedefs
    typedef enum InternalPinName {
        ARM_PA_0 = GPIO_PORTA_BASE, ARM_PA_1, ARM_PA_2, ARM_PA_3,
        ARM_PA_4, ARM_PA_5, ARM_PA_6, ARM_PA_7, 
        ARM_PB_0 = GPIO_PORTB_BASE, ARM_PB_1, ARM_PB_2, ARM_PB_3,
        ARM_PB_4, ARM_PB_5, ARM_PB_6, ARM_PB_7,
        ARM_PC_0 = GPIO_PORTC_BASE, ARM_PC_1, ARM_PC_2, ARM_PC_3,
        ARM_PC_4, ARM_PC_5, ARM_PC_6, ARM_PC_7,
        ARM_PD_0 = GPIO_PORTD_BASE, ARM_PD_1, ARM_PD_2, ARM_PD_3,
        ARM_PD_4, ARM_PD_5, ARM_PD_6, ARM_PD_7,
        ARM_PE_0 = GPIO_PORTE_BASE, ARM_PE_1, ARM_PE_2, ARM_PE_3,
        ARM_PE_4, ARM_PE_5, ARM_PE_6, ARM_PE_7,
        ARM_PF_0 = GPIO_PORTF_BASE, ARM_PF_1, ARM_PF_2, ARM_PF_3,
        ARM_PF_4, ARM_PF_5, ARM_PF_6, ARM_PF_7
    } InternalPinName;

    typedef enum PinMode
    {
        Input = GPIO_DIR_MODE_IN,
        Output = GPIO_DIR_MODE_OUT,
        Hardware = GPIO_DIR_MODE_HW
    } PinMode;

    typedef enum IOIntMode
    { bla //TODO: change bla
    } IOIntMode;

    typedef enum AnalogInMode
    { ble //TODO: change bla
    } AnalogInMode;

// **********
// Structures
// **********

// Pin structure to hold port and address
    struct _pin_t
    {
      unsigned long port;
      uint8_t address; //TODO: check if needed
      unsigned char mask;
    };

// Port structure for buses
    typedef struct Port_t
    {
    } Port_t;

// Bus structure
    struct _pinBus_t
    {
    };

// Serial port structure to hold all port info
    struct _serial_t
    {
    };

// PWM structure
    struct _pwm_pin_t
    {
    };

// Scheduler structure
    struct _scheduler_t
    {
    };

// TimeCounter structure
    struct _time_counter_t
    {
    };

// I2C structure
    struct _i2c_t
    {
    };

// AnalogIn structure
    struct _analog_in_t
    {
    };

#include "inline.c"

#ifdef __cplusplus
}
#endif

#endif
// vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
